package com.project.blog.serviceImpl;


import com.project.blog.entity.Userme;
import com.project.blog.mapper.UsermeMapper;
import com.project.blog.vo.UsermeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UsermeService {

    @Autowired
    private UsermeMapper usermeMapper;

    public List<Userme> findUsermeByName(String usermeName) {
        return usermeMapper.findUsermeByName(usermeName);
    }

    public List<Userme> queryPage(Integer startRows) {
        return usermeMapper.queryPage(startRows);
    }

    public int getRowCount() {
        return usermeMapper.getRowCount();
    }

    public Userme insertUserme(Userme userme) {
        usermeMapper.insertUserme(userme);
        return userme;
    }

    public List<Userme> ListUserme() {
        return usermeMapper.ListUserme();
    }

    public int Update(Userme userme) {
        return usermeMapper.Update(userme);
    }

    public int delete(int usermeId) {
        return usermeMapper.delete(usermeId);
    }

    //    批量删除
    public int dels(List<Integer> ids) {
        return usermeMapper.dels(ids);
    }

    //    批量添加
    public int insertDepts(List<Userme> usermes) {
        try {
            return usermeMapper.insertDepartments(usermes);
        } catch (Exception e) {
            e.toString();
            return -1;
        }
    }

    //  多表查询（userme和usemecard中相同usermeId时候的信息查询出来）
    public List<UsermeVo> findUsermeAndIdcard(int usermeId) {
        return usermeMapper.findAllUsermeCardid(usermeId);
    }


}
